local ClientOHOH = _G.ClientOHOH;
local M = ClientOHOH.class.new(script, ClientOHOH.files.BaseComponent());
local UIManager = ClientOHOH.load.UIManager();
local HomeGui=UIManager.ui_list.HomeGui
local LanguageHelper= _G.LanguageHelper
local GlobalTipGui =UIManager.ui_list.GlobalTipGui;

local VipInfoGui=UIManager.ui_list.VipInfoGui

local gid=14
local vipConfig=_G.CommonOHOH.config.Goods[gid]

function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);
	self.dataBase=self.parent:GetComponent(ClientOHOH.load.Client_PlayerDataComponent());

	self.parent.UserDataEvent:Connect(function(data)
		if data["gamePass"] then
            self:UpdateVip(data["gamePass"]["gamepass_vip"])
		end
	end)

	self:UpdateVip(self.dataBase:GetData("gamePass")["gamepass_vip"])

    VipInfoGui:SetPrice(vipConfig.price)
    VipInfoGui.BuyEvent:Connect(function()
        self.parent.RobuxBuyEvent:Action(gid)
    end)
end;


function M.UpdateVip(self,isVip)
	if isVip then
		HomeGui:HideVip()
        VipInfoGui:Hide()
	end
end


function M.dtor(self)
	M.super.dtor(self);
end;


return M